-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Feature Camera Player EH #982
Conversation
---------------------------------------------------------------------------- */ | ||
SCRIPT(registerFeatureCamera); | ||
|
||
GVAR(featureCameras) pushBackUnique _this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably add argument checking.
@@ -192,6 +200,12 @@ if (_id != -1) then { | |||
GVAR(oldCameraView) = _data; | |||
[QGVAR(cameraViewEvent), [_player, _data]] call CBA_fnc_localEvent; | |||
}; | |||
|
|||
_data = call CBA_fnc_getActiveFeatureCamera; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
performance?
We might want to only add this when it's actually needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a bunch of null checks (7 in vanilla). Aren't all Player EHs only added when they are needed already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.0301 - 0.031 ms on 10k/10k cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.03 ouhhhh.
How about a check whether either the array of eventhandlers is not empty (by using the CBA internal variable name of the array)
Or check that GVAR(oldFeatureCamera
is not nil? and set it to non nil once a Eventhandler is added in line 92?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't work for cases where we might want to use internal variable (ref ACE PR).
https://github.com/CBATeam/CBA_A3/compare/camera-playerEH...featureCamOpti?expand=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check should be every .5 seconds, like it was in ACE.
Comments on the commits, not the PR :x |
Well yes, they were made before that code was merged into this branch with the PR. How are you supposed to comment on the PR if it doesn't exist? |
@commy2 is this good or should it be completely split from |
GVAR(oldFeatureCamera) = _data; | ||
[QGVAR(featureCameraEvent), [call CBA_fnc_currentUnit, _data]] call CBA_fnc_localEvent; | ||
}; | ||
}] call CBA_fnc_compileFinal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason to compileFinal this. It is only done for Map, because it is a mission event handler and therefore affected by the recompiled-every-execution-bug. That however does not apply to CBA PFH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, needs testing
I have tested it, works perfectly fine with ACE3 (with acemod/ACE3#6573) and ACRE2 (with IDI-Systems/acre2#582). |
@@ -214,6 +222,15 @@ if (_id != -1) then { | |||
}; | |||
} call CBA_fnc_directCall; | |||
}; | |||
|
|||
GVAR(playerEHInfo) pushBack ([{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handler is still always added even if noone is listening for it.
Seems to be fairly easy to just add it in L92 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this since acemod/ACE3@922774d. Unsure how worth it is though, ACE3 is already set to use it and that covers a pretty big range of CBA users.
* master: Add Feature Camera Player EH (#982) German brands for JR and JAM components (#988) veteran29 Polish translation updates master (#986) German translation, part 3 (#981) German translation, part 2 (#980) German translation, part 1 (#979) add Joint Ammo Magazines A3 (#928) CBA_fnc_getVolume not calculating volume correctly (#984) ProjectileTracking - Stop tracking stationary objects (#985)
When merged this pull request will:
"featureCamera"
Player Event Handler